﻿using System.Linq;
using SchemaGen.Xsd;
using SchemaGen.Attributes;
using System.Reflection;

namespace Console
{
    /// <remarks>Should maybe make a PowerShell Cmdlet that gives good errors and stuff instead of this crappy bare-bones thing.</remarks>
    class Program
    {
        static void Main(string[] args)
        {
            var assembly = Assembly.LoadFrom(args[0]);

            foreach (var type in assembly.GetTypes()
                .Where(t => t.GetCustomAttributes(typeof(XmlDocumentAttribute), false).Count() > 0))
            {
                SDocument.GenerateFromType(type).Save();
            }
        }

    }
}
